/**
 * @Date: Mar 3, 2010 5:03:17 PM
 */
package com.philip.journal.core;

import com.philip.core.BusinessServiceProxy;

/**
 * @author cry30
 */
public abstract class Constant { // NOPMD by r39

    /** Utility class. */
    private Constant() {}

    /** Server-side session key constant for the currently logged-in user. */
    public static final String CURRENT_USER = "CurrentUser";

    /** Temporary place holder key for search result in session. */
    public static final String CURRENT_ENTRY_SEARCH = "CurrentEntrySearch"; // NOPMD by r39 on 4/4/11 5:30 PM

    /** Current key used for CURRENT_ENTRY_SEARCH. */
    public static final String CURRENT_ENTRY_SEARCH_KEY = "CurrentEntrySearch_Key"; // NOPMD by r39 on 4/4/11 5:30 PM

    /** Branch name of the root branch. */
    public static final String ROOT_NAME = "Root";

    /** Branch ID of the root branch. */
    public static final long ROOT_ID = 1L;

    /** Prefix for Branch ID. */
    public static final String BRANCHID_PREFIX = "/b-";
    /** Prefix for Entry ID. */
    public static final String ENTRYID_PREFIX = "/l-";

    /** Session key holder for application service facade. */
    public static final String SERVICE_FACADE = BusinessServiceProxy.SERVICE_FACADE;

    /** Session attribute holder for the current application version. */
    public static final String APP_VERSION = "appVersion";

    /**
     * Constants keys for BeanToMapConverters.
     */
    public final class BeanConverter {

        /** Utility constant class. */
        private BeanConverter() {}

        /** RTFC. */
        public static final String BRANCH_TO_JSON = "branch";

        /**
         * Converter for Entry as node. Does not contain all properties for the Entry, only those needed to
         * represent this in a Tree.
         */
        public static final String ENTRY_TO_JSONNODE = "entry";

        /** Converter for Entry as a detail. */
        public static final String ENTRY_TO_JSON = "entryObject";

        /** ConfigItem to JSON. */
        public static final String CFGITEM_TO_JSON = "configItem";
    }

    /** Constant class for node property. */
    public final class NodeProperty {
        /** Utility constant class. */
        private NodeProperty() {}

        /** Node size either Title for Branches or Title + Entry Contents for Entries. */
        public static final String SIZE = "size";

        /** RTFC. */
        public static final String CREATED = "created";

        /** RTFC. */
        public static final String MODIFIED = "modified";

        /** RTFC. */
        public static final String PATH = "path";
    }

    /** RTFC. */
    public final class EntrySearchProperty {
        /** Utility constant class. */
        private EntrySearchProperty() {}

        /** RTFC. */
        public static final String TITLE = "title";
        /** RTFC. */
        public static final String SUMMARY = "summary";
        /** RTFC. */
        public static final String TREEPATH = "treePath";
        /** RTFC. */
        public static final String PATH = "path";
        /** RTFC. */
        public static final String ENTRY_ID = "entryId";
        /** RTFC. */
        public static final String LAST_UPDATE = "lastUpdate";
    }

    /** RTFC. */
    public final class SortOrder {
        /** Utility constant class. */
        private SortOrder() {}

        /** RTFC. */
        public static final String ASC = "ASC";

        /** RTFC. */
        public static final String DESC = "DESC";
    }

    /**
     * Currently unused.
     *
     * @return Application package.
     */
    public static String getAppPackage() {
        final String pkg = Constant.class.getPackage().toString();
        final int firstDot = pkg.indexOf('.');
        return pkg.substring(0, pkg.indexOf('.', firstDot + 1));
    }

}
